#define _CRT_SECURE_NO_WARNINGS 1

void Init(int* arr, int size)
{
    int i = 0;
    for (i = 0; i < size; i++)
    {
        arr[i] = 0;
    }
}

int lengthOfLongestSubstring(char* s) {
    if (strlen(s) == 0)
        return 0;
    int arr[512] = { 0 };
    int i = 0;
    int max;
    for (i = 0; s[i] != '\0'; i++)
    {
        Init(arr, 256);
        int j = i;
        int count = 0;
        while (s[j] != '\0' && arr[s[j]] == 0)
        {
            arr[s[j]] = 1;
            count++;
            j++;
        }
        if (count > max)
            max = count;
    }
    return max;
}